<?php
namespace Admin\Controller;
use Think\Controller;
class WishManageController extends CommonController {
    public function index(){ //显示的愿望管理页   这个显示是需要判断用户是否登录
        //查询所有愿望
        $sname=I('get.sname',"");
        
        $wish=M("notes");
        
        $p=I('get.p',1);
        
        $wishda=$wish->where("name like '%$sname%' ")->select();
        //dump($sname);
        //die();->page($p.'5')
      
        $count=$wish->count();
        $PAGE=new \Think\Page($count,5);
        $PAGE->setConfig('header','共有%TOTAL_PAGE%页,当前是第%NOW_PAGE%页<br/>');
        $PAGE->setConfig('first',"首页");
        $PAGE->setConfig('last',"尾页");
        $PAGE->setConfig('prev',"上一页");
        $PAGE->setConfig('next',"下一页");
        $PAGE->setConfig('thene','$HEADER%  $FTRSI%  %UP_PAGE%  %DOWN_PAGE%  %END%');
    
        //dump($count);测试问题
        //die();
        $show=$PAGE->show();
        $this->assign("wish",$wishda);
        $this->assign("page",$show);
        $this->display();       
    }  
     public function del()
     {
        $id=I('get.id',0);
	//实例化模型类

	$model=M('notes'); 	     

	$rs=$model->delete($id);
	if ($rs)
	   { //设置成功后跳转页面的地址，
          $this->success('删除成功', U('Admin/WishManage/index'));  
	   }
	   else
	   { //错误页面的默认跳转页面是返回前一页，通常不需要设置
         $this->error('删除失败');
	   }
     }
}